<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="filters">

				<el-form-item>
					<el-input v-model="filters.rechargePhone" placeholder="电话号码"></el-input>
				</el-form-item>
				<!--<el-form-item label="学校状态"  >-->
					<!--<el-select v-model="filters.schoolstatus" placeholder="请选择学校状态" >-->
						<!--<el-option value="0" label="全部">全部</el-option>-->
						<!--<el-option value="1" label="全部">未使用</el-option>-->
						<!--<el-option value="2" label="全部">已使用</el-option>-->
					<!--</el-select>-->
				<!--</el-form-item>-->
				<el-form-item>
					<el-button type="primary" v-on:click="findPageGroupMember">查询</el-button>
				</el-form-item>
			</el-form>
		</el-col>
		<!--列表-->
		<template>
			<el-table :data="crows" highlight-current-row v-loading="loading" border max-height="620" style="width: 100%;">
				<el-table-column type="index" width="80" label="编号">
				</el-table-column>
				<el-table-column prop="rechargePhone" label="充值号码" >
				</el-table-column>
				<el-table-column prop="mealId" label="套餐Id" >
				</el-table-column>
				<el-table-column prop="groupStatus" label="状态" :formatter="formatSchoolStatus" >
				</el-table-column>
				<el-table-column prop="tryNum" label="尝试次数" >
				</el-table-column>
				<el-table-column prop="ordernum" label="系统订单号" >
				</el-table-column>

				<el-table-column prop="createTime" label="创建时间"   >
				</el-table-column>
				<el-table-column prop="rechargeTime" label="充值时间"   >
				</el-table-column>


				<!--<el-table-column label="操作"    width="220">-->
					<!--<template scope="scope"   >-->
						<!--<el-button size="small"   @click="handleEnable(scope.$index, scope.row)">-->
						 <!--编辑-->
						<!--</el-button>-->
					<!--</template>-->
				<!--</el-table-column>-->
			</el-table>
		</template>
		<el-pagination
				@current-change="handleCurrentChange"
				@size-change="handleSizeChange"
				layout="total,sizes,prev, pager, next"
				:total="total">
		</el-pagination>
	</section>

</template>
<script>
	import { findPageGroupMember} from '../../api/api';
	export default {
		data() {
			return {
				filters: {
                    rechargePhone: '',
				},
				start:0,
				pageSize:10,
                total:0,
				loading: false,
                crows: []
			}
		},
		methods: {
            formatSchoolStatus: function (row, column) {
                return row.groupStatus === 1 ? '未提交' : row.groupStatus === 2 ? '提交成功' : row.groupStatus === 3 ? "充值成功" : row.groupStatus === 0 ? "充值失败" :  "其他";//状态 1  2 3 0
            },
            findPageGroupMember: function () {
				let para = {
                    rechargePhone: this.filters.rechargePhone,
					start:this.start,
					pageSize:this.pageSize
				};
				this.loading = true;
                findPageGroupMember(para).then(datas => {
                    this.loading = false;
                    let { message, code, data } = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        this.crows = data.result;
                        this.total = data.totalCount;
                    }
                }).catch(e =>{

				});
			},
			handleCurrentChange:function(val){
                this.start = val - 1;
                this.findPageGroupMember();
			},
            handleSizeChange:function(val){
			    this.pageSize = val;
			    this.findPageGroupMember();
			}
		},
		mounted() {
			this.findPageGroupMember();
		}
	};

</script>

<style scoped>

</style>
